﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>JuiceUp排毒蔬果汁</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes"> 
<meta name="mobile-web-app-capable" content="yes"> 
<meta content="JuiceUp,排毒蔬果汁,JuiceUp排毒蔬果汁，果汁, 果蔬汁, 排毒果汁, 排毒果蔬汁 ,排毒,冷压果汁" name="keywords" />
<meta content="作为排毒果汁领域中的专业品牌，JuiceUp将欧美最为流行的轻断食排毒果汁法带入了中国。我们希望通过这样一种健康、便捷且时尚的生活方式，让生活在繁忙大都市中的您也能如好莱坞明星一般轻松拥有最美肌肤和最佳体型。" name="description" />


<link rel="stylesheet" type="text/css" media="screen" href="<%templateskin%>/css/default.css" />
<script type="text/javascript" src="../../scripts/jquery/jquery-1.10.2.min.js"></script>
 
     <script type="text/javascript" src="../../scripts/lhgdialog/lhgdialog.js?skin=idialog"></script>


     
<script type="text/javascript">
    function logincke() {
        $.ajax({
            type: "POST",
            url: "{config.webpath}tools/submit_ajax.ashx?action=user_check_login",
            dataType: "json",
            timeout: 20000,
            success: function (data, textStatus) {
                if (data.status == 1) {
                    $("#menu a").remove();
                    $("#menu").append('<a  rel="external nofollow"   href="<%linkurl("usercenter","exit")%>&url=mobile.aspx">退出</a>');

                } else {
                    $("#menu a").remove();
                    $("#menu").append('<a  href="javascript:void(0)">登录</a>').click(function () {
                        $("#login").show();

                    }); ;

                }
            }
        });
    }
    $(function () {
        logincke();
        GetAddress();
        codeck();
 if ($("input[name='codetype']:checked").val() == 4) {
            $("#liaocehng").show();
            $("#divcode").hide();
        }
    });
    function GetAddress() {

        $.ajax({
            type: "POST",
            url: "{config.webpath}tools/submit_ajax.ashx?action=GetAddress",
            dataType: "json",
            timeout: 20000,
            success: function (data, textStatus) {
                if (data.userid != 0) {
                    $("#spmobile").show();
                    $("#spmobile").text(data.Mobile);

                }
                else {
                    $("#spmobile").hide();
                }
                if (data.status == 1) {
                    $("#accept_name").val(data.address.name);
                    $("#mobile").val(data.address.mobile);
                    $("#diqu").val(data.address.area.split(",")[2]);
                    $("#address").val(data.address.address);


                }

            }
        });
    }
    function total() {
        var temp = $("#code");
        var type = $("input[name='codetype']:checked").val();
        var v = temp.val();
        if (temp.val() != "") {
            if (type == 3) {
                if (isNaN(v)) {
                    $.dialog.tips("多人订购只能输入数字!", 3, "32X32/hits.png");
                    temp.focus();
                    return;
                }
            }
        }
        else {

            $.dialog.tips("您输入的内容不能为空!", 3, "32X32/hits.png");

            temp.focus();
            return;
        }

        codeck();
    }

    function liaochengTotal(obj) {
        var text = $(obj).find("option:selected").attr("title");
        var order_amount =$("input[name='goods_id']:checked").attr("title");
        var count = order_amount == 980 ? 3 : 1;
        if (count > parseInt(text)) {
            $.dialog.tips("您的疗程次数不足请选择单次订购!", 3, "32X32/hits.png");
            
            return;
        }
        codeck();
    }
    function codeck() {
        var order_amount =$("input[name='goods_id']:checked").attr("title");
        var goods_id=$("#goods_id").val();
        var type=$("input[name='codetype']:checked").val();
        var code=$("#code").val();
        if ($("#code").val() != "") {
            if (type == 1 || type == 2) {
                var typename = type == 1 ? "zhe" : "li";
                $.ajax({
                    type: "POST",
                    url: "{config.webpath}tools/submit_ajax.ashx?action=theyard",
                    data: { "sn": code, "type": typename },
                    dataType: "json",
                    timeout: 20000,
                    success: function (data, textStatus) {
                        if (data.status == "1") {

                            if (data.code == "1天" && order_amount != "350") {
                                if (type == 1) {
                                    $.dialog.tips("您所使用的是3天折扣码,请重新选择您的计划!", 3, "32X32/hits.png");
                                }
                                else {
                                    $.dialog.tips("您所使用的是3天礼品码,请重新选择您的计划!", 3, "32X32/hits.png");
                                }
                            }
                            else if (data.code == "3天" && order_amount != "980") {

                                if (type == 1) {
                                    $.dialog.tips("您所使用的是1天折扣码,请重新选择您的计划!", 3, "32X32/hits.png");
                                }
                                else {
                                    $.dialog.tips("您所使用的是1天礼品码,请重新选择您的计划!", 3, "32X32/hits.png");
                                }

                            } else {

                                if (type == 1) {
                                    if (data.code != "减免") {
                                        if (data.sn == "8.5") {

                                            order_amount = order_amount * 0.85;

                                        } else {

                                            order_amount = order_amount * 0.50;

                                        }
                                    }
                                    else {
                                        order_amount = order_amount - data.sn;
                                    }
                                }
                                else {
                                    order_amount = 0;
                                }
                                var temp = $("#texCoolbag");
                                var payment_fee = 28 * temp.val();

                                order_amount = parseFloat(order_amount) + parseFloat(payment_fee);
                                $("#order_amount").text(parseFloat(order_amount).toFixed(2));
                            }


                        }
                        else {
                            $.dialog.tips(data.msg, 4, "32X32/hits.png");
                        }


                    }
                });
            }
            else if (type == 3) {
                order_amount = order_amount * code;
                if (code >= 8) {
                    order_amount = order_amount * 0.85;

                }
                else if (code >= 5) {
                    order_amount = order_amount * 0.90;
                }
                else if (code >= 3) {
                    order_amount = order_amount * 0.95;
                }
                var temp = $("#texCoolbag");
                var payment_fee = 28 * temp.val();

                order_amount = parseFloat(order_amount) + parseFloat(payment_fee);
                $("#order_amount").text(parseFloat(order_amount).toFixed(2));
            }
            else {
                var count = order_amount == 980 ? 3 : 1;
                var sellc = $("#selliaochng");
                if (sellc.length > 0) {

                    var data = $("#selliaochng").find("option:selected").attr("title");


                    if (count <= parseInt(data)) {

                        $("#goods_amount").text(0);
                        order_amount = 0;
                    }
                }
                var temp = $("#texCoolbag");
                var payment_fee = 28 * temp.val();

                order_amount = parseFloat(order_amount) + parseFloat(payment_fee);
                $("#order_amount").text(parseFloat(order_amount).toFixed(2));
            }
        }
        else {
            var temp = $("#texCoolbag");
            var payment_fee = 28 * temp.val();

            order_amount = parseFloat(order_amount) + parseFloat(payment_fee);
            $("#order_amount").text(parseFloat(order_amount).toFixed(2));
        }
    }
    function CoolbagAdd() {

        var temp = $("#texCoolbag");
        if (temp.val() != "") {
            if (isNaN(temp.val())) {
                $.dialog.tips('只能输入数字!', 2, "32X32/hits.png");

                temp.focus();
                return;
            }
        }
        else {
            $.dialog.tips("您输入的内容不能为空!", 3, "32X32/hits.png");

            temp.focus();
            return;
        }

        codeck();




    }

    $(document).ready(function(){
 $("input[name='codetype']").click(function() {
        var type = $("input[name='codetype']:checked").val();
        if (type == 4) {
            $("#liaocehng").show();
            $("#divcode").hide();
        }
        else {
        $("#code").val("");
          codeck();
            if (type == 1) {
                $("#code").attr("placeholder", "（选填）输入优惠码");
            }
            else if (type == 2) {
                $("#code").attr("placeholder", "（选填）输入礼品码");
            }
            else if (type == 3) {
                $("#code").attr("placeholder", "（选填）输入订购人数");
            }
            $("#divcode").show();
            $("#liaocehng").hide();
        }
    });
    $("input[name='goods_id']").click(function() {
    
        var v =  $("input[name='goods_id']:checked").val();
        codeck();
    if (v == 1 || v == 3) {
        $("#datepicker").show();
        $("#datepicker1").hide();
    }
    else {
        $("#datepicker").hide();
        $("#datepicker1").show();
    }
    });
});
function showdiv(type,title) {

    if (type == 1) {
        $.dialog.alert2("1日排毒计划：350元（450ml×6瓶排毒蔬果汁）；连续3日排毒计划：980元（450ml×6瓶排毒蔬果汁×3日）。凡首次订购JuiceUp排毒蔬果汁都将会获赠价值88元的冷藏保温包一个。我们希望您能妥善保存，反复使用，为环保出一份力。若再次订购果汁时确有需要，您也可以28元的优惠价另行购买保温包。", title);
    } else if (type == 2) {
        $.dialog.alert2("周六、日及法定节假日不配送目前JuiceUp仅配送北京市五环以内地区，其他城市及地区敬请期待。全程0-4℃冷链物流。每日接收果汁时间有2:00pm-6:00pm及6:00pm-10:00pm两个选择。", title);
    }
    else {
        $.dialog.alert2("请您在接到果汁后尽快将果汁放到冰箱内冷藏保鲜，并且由于JuiceUp果汁内没有任何防腐成分或添加剂，所以请您务必在接到果汁后36小时内饮用完毕。", title);
    }
}

</script>
</head>
<body>
<%template src="_mobilediv.html"%>


  





<div id="wrapper" class="opacity">
  
  <div class="headertile"><span  id="menu" class="leftBtn"></span>JuiceUp   <span class="rightBtn" onClick="$('#mininav').toggle();">订购须知</span>
    <div class="mini_nav" id="mininav" onClick="$('#mininav').slideUp();" style=" display:none;">
      <span class="icon"></span>
      <ul>
     <li><a href="javascript:showdiv(1,'价格&优惠')">价格&优惠</a></li>
      <li><a href="javascript:showdiv(3,'订购及饮用时间')">订购及饮用时间</a></li>
      <li><a href="javascript:showdiv(2,'物流配送')">物流配送</a></li>
      </ul>
    </div></div>
   <form name="order_form" id="order_form" url="{config.webpath}tools/submit_ajax.ashx?action=morder_save">
   <div class="form-group">
                     <div class="tile"><strong>请选择商品</strong> </div>
                     </div>
                   <div class="form-group rule-multi-radio">
                
                     
    
      <label class="radio-inline"> <input checked="checked" name="goods_id" type="radio" value="1"   title="350" /> <span>Level1美味纤体一天</span> </label>
  <label class="radio-inline">    <input  name="goods_id" type="radio"  title="980" value="2" /><span>Level1美味纤体三天</span></label>
   <label class="radio-inline">   <input  name="goods_id" type="radio"  title="350" value="3" /><span>Level2深层清体一天</span></label>
       <label class="radio-inline"> <input  name="goods_id" type="radio"  title="980" value="4" /><span>Level2深层清体三天</span></label>
 
  </div>
  <div class="form-group">
    <div class="tile"><strong>排毒日期</strong> 送达日为排毒日前一天</div>
    <div>
      <div id="datepicker"></div>
       <div id="datepicker1" style="display:none"></div>
        <input id="sDate" name="sDate"  datatype="*2-100" nullmsg="请选择送货日期!" errormsg="请选择送货日期！" value="" type="hidden" />
        
        <input id="urlid" name="url" type="hidden" />
    </div>
  </div>
  
  
  <div class="form-group">
  <div class="tile"><strong>配送信息</strong></div>
    <input type="text" placeholder="输入姓名" id="accept_name" nullmsg="请输入姓名!" datatype="s2-20" errormsg="请输入姓名!" name="accept_name" class="form-control short">
    <label class="radio-inline"><input checked="" name="sex" type="radio" value="option1"><span>女士</span></label>
    <label class="radio-inline"><input name="sex" type="radio" value="option2"><span>男士</span></label>
  </div>
  <div class="form-group">
    <input type="text" placeholder="联系电话"  datatype="m" sucmsg=" " nullmsg="请输入联系电话" errormsg="请输入正确的手机号!" id="mobile" name="mobile" class="form-control">
  </div>
  <div class="form-group rule-single-select short100">
    <select class="form-control" name="diqu" id="diqu">
      <option value="东城区">东城区</option><option value="西城区">西城区</option><option value="朝阳区">朝阳区</option><option value="丰台区">丰台区</option><option value="石景山区">石景山区</option><option value="海淀区">海淀区</option><option value="门头沟区">门头沟区</option><option value="房山区">房山区</option><option value="通州区">通州区</option><option value="顺义区">顺义区</option><option value="昌平区">昌平区</option><option value="大兴区">大兴区</option><option value="怀柔区">怀柔区</option><option value="平谷区">平谷区</option>
    </select>
  </div>
  <div class="form-group">
    <input type="text" placeholder="配送地址"  onblur="ptOutPolygon();"  datatype="*2-100" sucmsg=" " nullmsg="请输入配送地址" name="address" id="address" class="form-control">
    <input
              id="addcke" type="hidden" />
  </div>
<div class="form-group">
  
  <span class="tet  left mar_r10">送达时间:</span>
  <div class="rule-single-select short75"><select class="form-control" id="time" name="time">
  <option value="1" >2:00pm-6:00pm</option>
  <option value="2">6:00pm-10:00pm</option>
    </select></div>
    
  </div>
  <!--<div class="address">
    <dl>
      <dt>已登录账号：<span class="red">123123123123123</span></dt>
      <dd>
      此号码可接受交易短信，登录XXXXX可管理订单。
      </dd>
    </dl>
    <dl>
      <dt>收货人信息：</dt>
      <dd>
      姓名姓名&nbsp;&nbsp;13800797968<br>
      海淀区&nbsp;&nbsp;高米店北是大号适当带点
      </dd>
    </dl>
  </div>-->
<div  class="form-group">
   <div class="tile"><strong>支付信息</strong> </div>
   </div>
<div  class="form-group rule-multi-radio">
 <%if(IsUserLogin())%>
                       <%set DataTable liaocheng=getliaocheng(userModel.id)%>
                       <%if(liaocheng.Rows.Count>0)%>
<label class="radio-inline"><input checked="checked" name="codetype" type="radio"  value="4" ><span>疗程卡</span></label>
                      
                       <%/if%>
                       <%/if %>
 <label class="radio-inline"><input checked="" name="codetype" type="radio"  value="1" ><span>优惠码</span></label>
    <label class="radio-inline"><input name="codetype" type="radio"  value="2"><span>礼品卡</span></label>
<label class="radio-inline"><input name="codetype" type="radio"  value="3"><span>多人订购</span></label>
</div>
  <div class="form-group ">
   
    <div id="divcode">
    <input type="text" placeholder="（选填）输入优惠码" id="code" name="code" class="form-control short75 left">
    <span class="tet"  style="display:none">人</span>
    <input class="btn btn-info" onclick="total();" type="button" value="验证">
    </div>
     <%if(IsUserLogin())%>
                       <%set DataTable liaocheng=getliaocheng(userModel.id)%>
                       <%if(liaocheng.Rows.Count>0)%>
    <div  id="liaocehng" class="rule-single-select short100"  style="display:none">
        
                       <script>
                           $(function () {
                               codeck();
                           });
                       </script>
                        <%set string listrs=""%>
    <select id="selliaochng" class="form-control short35 left mar_r10" name="selliaochng" onchange="liaochengTotal(this)">

                              <%loop lhs liaocheng%>
                            <%csharp%>listrs=liaochengtype({lhs[type]},{lhs[number]},{lhs[state]},{lhs[field]},{lhs[endtime]});<%/csharp%>
                                <option value="{lhs[id]}" title="{lhs[number]}">{listrs}</option>
                                <%/loop%>
                               
                            </select>   
    </div>
    <%/if%>
                       <%/if %>
  </div>
  <div class="form-group" style="display:none">
   <span class="tet  left mar_r10">添加冷藏包</span>
    <input type="text" placeholder="请输入数量"  id="texCoolbag" name="texCoolbag" class="form-control short35 left mar_r10">  <input class="btn btn-info right" onclick="CoolbagAdd();" type="button" value="添加">
  </div>
    
   <div class="address" style="display:none;">
    <dl>
      <dt>已登录账号：<span class="red" id="spmobile"></span></dt>
      <dd>
      登录http://juiceupcleanse.com我的JuiceUp可管理订单。
      </dd>
    </dl>
    
  </div>
    <div class="form-group">
     
    <input type="text" name="message" id="message" placeholder="微信号或订单备注 - 方便卖家与您联系" class="form-control short100">
  </div>
<div class="form-group">
    <div class="short50 left"><span class="tet">金额</span></div>
    <div class="short50 left"><span class="tet"><strong class="red" id="order_amount" style="font-size:16px;">0</strong>&nbsp;元</span></div>
  </div>
  <div class="form-group">
    <div class="short50 left"><span class="tet">付款方式</span></div>
    <div class="short50 left rule-single-select">
        <select class="form-control" name="payment_id" id="payment_id">
         <%if(IsUserLogin())%>
                       <%set DataTable liaocheng=getliaocheng(userModel.id)%>
                       <%if(liaocheng.Rows.Count>0)%>
                         <option value="3">疗程卡</option>
                       <%/if%>
                       <%/if%>
          <option value="3">在线支付</option>
          <option value="1">货到付款</option>
        </select>
    </div>
  </div>
  <div class="form-group">
    <input class="btn btn-primary short100 btn-big" id="orbtnSubmit" type="submit" value="提交订单">
  </div>
  </form>
  
    
               
  <div style=" clear:both; height:10px;"></div>
  
  
</div>


<script type="text/javascript">
/*表单AJAX提交封装(包含验证)*/
    function AjaxInitForm(formId, btnId, isDialog, urlId) {

       
            var formObj = $('#' + formId);
            var btnObj = $("#" + btnId);
            var urlObj = $("#" + urlId);
            formObj.Validform({
                tiptype: function (msg, o, cssctl) {
                    if (o.type == 3) {
                        $.dialog.tips(msg, 2, "32X32/hits.png");
                    }
                }, beforeSubmit: function (curform) {
                    if ($("#addcke").val() != "") {
                        $.dialog.tips("您的地址在五环外，只配送五环内的订单！", 2, "32X32/hits.png");
                        return false;
                    }
                },
                callback: function (form) {
                    //AJAX提交表单
                    $(form).ajaxSubmit({
                        beforeSubmit: formRequest,
                        success: formResponse,
                        error: formError,
                        url: formObj.attr("url"),
                        type: "post",
                        dataType: "json",
                        timeout: 60000
                    });
                    return false;
                }
            });
        
        //表单提交前
            function formRequest(formData, jqForm, options) {
       
            ptOutPolygon();
            btnObj.prop("disabled", true);
            btnObj.val("提交中...");
        }

        //表单提交后
        function formResponse(data, textStatus) {
            if (data.status == 1) {
                btnObj.val("提交成功");
                //是否提示，默认不提示
                if (isDialog == 1) {
                    $.dialog.tips(data.msg, 2, "32X32/succ.png", function () {
                        if (data.url) {
                            location.href = data.url;
                        } else if (urlObj.length > 0 && urlObj.val() != "") {
                            location.href = urlObj.val();
                        } else {
                            location.reload();
                        }
                    });
                } else {
                if (typeof (data.show) == "undefined") {
                    if (data.url) {
                        location.href = data.url;
                    } else if (urlObj) {
                        location.href = urlObj.val();
                    } else {
                        location.reload();
                    }
                }
                else {
                    openrep();
                }
                }
            } else {
                $.dialog.alert(data.msg);
                btnObj.prop("disabled", false);
                btnObj.val("再次提交");
            }
        }
    
        //表单提交出错
        function formError(XMLHttpRequest, textStatus, errorThrown) {
            $.dialog.alert("状态：" + textStatus + "；出错提示：" + errorThrown);
            btnObj.prop("disabled", false);
            btnObj.val("再次提交");
        }
    }
    
    //窗口API
    </script>
  <script type="text/javascript">
      $(function () {
          AjaxInitForm('order_form', 'orbtnSubmit', 0, 'urlid');
      });
  </script>
  
            


  

     <script type="text/javascript" src="<%templateskin%>/js/JScriptui.js"></script>
    
  <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=OYonZmtvxwM2fzf71C3rrZvB&services=&t='+(new Date()).getTime()"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/GeoUtils/1.2/src/GeoUtils_min.js"></script>

<script type="text/javascript">
    Date.prototype.Format = function (fmt) { //author: meizz 
        var o = {
            "M+": this.getMonth() + 1, //月份 
            "d+": this.getDate(), //日 
            "h+": this.getHours(), //小时 
            "m+": this.getMinutes(), //分 
            "s+": this.getSeconds(), //秒 
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
            "S": this.getMilliseconds() //毫秒 
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }
    var dateall = [];
    function dateadd(date, i) {
        for (var j = 0; j < i; j++) {
            dateall.push(new Date(date.setDate(date.getDate() + 1)));
        }
    }
    function tests(datep, type, i) {
        if (dateall.length == 0) {
            var setdate = new Date();
            setdate.setFullYear(2014, 3, 6);

            dateadd(setdate, 2 + i);
            if (type == 3) {
                setdate.setFullYear(2014, 3, 29);
            } else {
                setdate.setFullYear(2014, 3, 30);
            }
            dateadd(setdate, 3 + i);
            if (type == 3) {
                setdate.setFullYear(2014, 4, 12);
            } else {
                setdate.setFullYear(2014, 4, 12);
            }
            dateadd(setdate, 2 + i);
            if (type == 3) {
                setdate.setFullYear(2014, 4, 26);
            } else {
                setdate.setFullYear(2014, 4, 26);
            }
            dateadd(setdate, 1 + i);
            if (type == 3) {
                setdate.setFullYear(2014, 4, 31);
            } else {
                setdate.setFullYear(2014, 4, 31);
            }
            dateadd(setdate, 4 + i);
            if (type == 3) {
                setdate.setFullYear(2014, 8, 5);
            } else {
                setdate.setFullYear(2014, 8, 6);
            }
            dateadd(setdate, 3 + i);
            if (type == 3) {
                setdate.setFullYear(2014, 8, 30);
            } else {
                setdate.setFullYear(2014, 9, 1);
            }
            dateadd(setdate, 7 + i);
        }
        for (var i = 0; i < dateall.length; i++) {
            if (new Date(dateall[i]).Format("yyyy-MM-dd") == datep.Format("yyyy-MM-dd")) {
                return true;
            }

            // alert(new Date(dateall[i]).Format("yyyy-MM-dd"));

        }
        return false;
    }
    function testwile(type) {
        var myDate = new Date();

        if (new Date().getHours() < 12) {
            myDate.setDate(myDate.getDate() + 2);
        }
        else {
            myDate.setDate(myDate.getDate() + 3);
        }
        //    if (type == 3) {
        //        while ((myDate, 3, 0)[0] == false) {
        //            myDate.setDate(myDate.getDate() + 1);
        //        }
        //    }
        //    else {
        //        while (selectedDate(myDate, 1, 0)[0] == false) {
        //            myDate.setDate(myDate.getDate() + 1);
        //        }
        //    }

        return myDate;

    }






    function setcontent(Days) {
        //		        if (Days == "a") {

        //                var order_amount=0;
        //		            var d = new Date(currDT);

        //		            Data.length = 0;
        //		            for (var j = 0; j < starti; j++) {

        //		               var s = j == 0 ? 0 : 1;

        // Data.push({ "id": j, g: [], "e": d.setDate(d.getDate() +s), "t": 3 ,"a":0,"s":0});
        //                       
        //		                for (var h = 0; h < plist.length; h++) {
        //		                    Data[j].g.push(plist[h]);
        //                            order_amount=Number(order_amount+plist[h].j);
        //		                }
        //		            }
        //                   if(starti==3)
        //                   {
        //                   order_amount=980;
        //                   } 
        //                    $("#price").text(order_amount)
        //                    $("#price1").text(order_amount)
        //		        }
        //                



    }





		   
</script>   
	<script  type="text/javascript">


	    function selectedDate(date, type, i, currDTt) {



	        var d = date.getDay();
	        var ret = [true, 'hasCourse'];
	        //		        if (tests(date, type, i)) {
	        //		            ret = [false, 'noCourse'];
	        //		        }
	        if (type == 3) {
	            if (d == 0 || d == 6 || d == 5 || d == 1) {
	                ret = [false, 'noCourse'];

	            }
	        }
	        else {
	            if (d == 0 || d == 1) {
	                ret = [false, 'noCourse'];

	            }

	        }



	        if (show) {
	            if (currDTt) {
	                if (type == 3) {

	                    var newcurrDT = new Date(currDTt);
	                    newcurrDT.setDate(newcurrDT.getDate() + 3);


	                    if (currDTt <= date && date < newcurrDT) {

	                        ret[1] = "selCourse";
	                    }


	                }


	                else {
	                    if (currDTt.Format("yyyy-MM-dd") == date.Format("yyyy-MM-dd")) {
	                        ret[1] = "selCourse";
	                    }
	                }
	            }
	        }

	        return ret;
	    }
	    currDT = testwile(1);
	    currDT1 = testwile(3);
	    var show = false;
	    $(function () {


	        //初始化日期加载
	        function initDate(myDates, type) {
	      var varld=new Date(myDates);
	      varld.setDate(varld.getDate()-1);
	            $("#sDate").val(varld.Format("yyyy-MM-dd"));
	            if (type = 1) {

	                currDT = myDates;
	            }
	            else {
	                currDT1 = myDates;
	            }




	        }

	        $("#datepicker").datepicker({ "minDate": currDT,
	            showOtherMonths: true,
	            selectOtherMonths: true,
	            onSelect: function (date) {
	                show = true;
	                initDate(new Date(date), 1);
	            },
	            beforeShowDay: function (date) {
	                return selectedDate(date, 1, 0, new Date(currDT));
	            }
	        });
	        $("#datepicker1").datepicker({ "minDate": currDT,
	            showOtherMonths: true,
	            selectOtherMonths: true,
	            onSelect: function (date) {
	                show = true;
	                currDT1 = new Date(date);
	                initDate(new Date(date), 2);
	            },
	            beforeShowDay: function (date) {
	                return selectedDate(date, 3, 0, new Date(currDT1));
	            }
	        });

	    });
	    
	    
	</script>
<script type="text/javascript">


    var myGeo = new BMap.Geocoder();

    pts = [new BMap.Point(116.230249, 39.995418),
new BMap.Point(116.215302, 39.881233),
new BMap.Point(116.232549, 39.848448),
new BMap.Point(116.269344, 39.815646),
new BMap.Point(116.284292, 39.781054),
new BMap.Point(116.311887, 39.783716),
new BMap.Point(116.377428, 39.77928),
new BMap.Point(116.399275, 39.76242),
new BMap.Point(116.438369, 39.789038),
new BMap.Point(116.488961, 39.812099),
new BMap.Point(116.525756, 39.832492),
new BMap.Point(116.555652, 39.853765),
new BMap.Point(116.547603, 39.943218),
new BMap.Point(116.487812, 40.017524),
new BMap.Point(116.440669, 40.024597),
new BMap.Point(116.341783, 40.025481),
new BMap.Point(116.283142, 40.013988),
new BMap.Point(116.2291, 39.997186)];
    var ply = new BMap.Polygon(pts);



    function ptOutPolygon() {

        var keyword = $("#address").val();
        if (keyword == "") {
            return false;
        }
        myGeo.getPoint(keyword, function (poi) {
            if (poi) {

                var result = BMapLib.GeoUtils.isPointInPolygon(poi, ply);
                if (result == false) {
                    $.dialog.tips("您的地址在五环外，只配送五环内的订单！", 2, "32X32/hits.png");
                    //  W.$.dialog.alert('', function () { $("#txtAddress").focus(); }, api);
                    $("#addcke").val("123");
                    return false;
                    // fild = 0;
                }
                else {
                    $("#addcke").val("");
                    //$.dialog.tips("您的地址是五环内",2, "32X32/succ.png");
                    // W.$.dialog.alert('您的地址是五环内', function () { $("#txtAddress").focus(); }, api);
                    //return false;
                    return true
                }


            }
            else {
                $("#addcke").val("123");
                $.dialog.alert('请输入正确的地址！', function () { $("#address").focus(); }, api);
                return false;
            }
            return poi;
        }, "北京");

    }
</script>
</body>
</html>